package com.xxk.rocket.star.core.annotation.impl;

import com.xxk.rocket.star.annotation.StargateOneWay;
import com.xxk.rocket.star.core.annotation.AbsProcessAnnotationProducer;
import com.xxk.rocket.star.core.dto.StargateOneWayDTO;

import java.lang.reflect.Method;

public class StargateOneWayProcessAnnotation
        extends AbsProcessAnnotationProducer<StargateOneWayDTO> {

  @Override
  protected void processProducer(StargateOneWayDTO stargateOneWayDTO, Class aClass, Object o,
                                 Method method) throws Throwable {
    StargateOneWay stargateOneWay = null;
    if (method == null) {
      stargateOneWay = (StargateOneWay) aClass.getAnnotation(StargateOneWay.class);
    } else {
      stargateOneWay = method.getAnnotation(StargateOneWay.class);
    }
    if (stargateOneWay == null) {
      return;
    }
    stargateOneWayDTO.setOneWay(true);
  }
}
